﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows;
using System.Data;
using System.Data.SqlClient;

namespace QuanLyNhaSach
{
    public partial class FormChinh : Form
    {
        private FormDangNhap formdangnhap = new FormDangNhap();
        private Control tabhide = new Control();
        private KetNoiCSDL ketnoi = new KetNoiCSDL();
        private DataTable dataTableNhanVien = new DataTable();
        private DataTable dataTableKhachHang = new DataTable();
        private String stringNhanVien="";
        private String stringKhachHang = "";
        private NguoiDung nguoidung = new NguoiDung();
        private FormNhanVien formNhanVien= new FormNhanVien();
        private FormKhachHang formKhachHanh = new FormKhachHang();
        
        public FormChinh()
        {
            InitializeComponent();                      
            labelThongTin.Text = "Nguyễn Văn A - 07520466";
            tabControl1.Enabled = false;          
            tabhide = tabControl1.TabPages[4];//disable tab nhan vien            
            stringNhanVien = "SELECT * FROM NHANVIEN";
            stringKhachHang = "SELECT * FROM KHACHHANG";
            dataTableNhanVien = ketnoi.LayCSDL(stringNhanVien);
            GridViewNhanVien.DataSource = dataTableNhanVien;
            dataTableKhachHang = ketnoi.LayCSDL(stringKhachHang);
            GridViewKhachHang.DataSource = dataTableKhachHang;
            labelThongTin.Text = nguoidung.tenDangNhap;
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormChinh());
            
            
        }
        private void thoatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            formdangnhap.ShowDialog(this);
            tabControl1.Enabled=true;
            
            //tabControl1.SelectedTab = tabPage5;
            
        }

        private void buttonThemNV_Click(object sender, EventArgs e)
        {
            formNhanVien.ShowDialog(this);
        }

        private void buttonSuaNV_Click(object sender, EventArgs e)
        {
            formNhanVien.ShowDialog(this);
        }

        //private void button1_Click(object sender, EventArgs e)
        //{
        //    //this.tabControl1.TabPages.Remove(tabPage5);
        //    tabhide.Enabled = false;
            
        //}

        //private void button2_Click(object sender, EventArgs e)
        //{
        //    //this.tabControl1.TabPages.Add(tabTemp);
        //    tabhide.Enabled = true;
        //}


    }
}
